//package fun.formoji.commons.oauth.handler;
//
//import com.alibaba.fastjson.JSON;
//import fun.formoji.commons.model.RestResponse;
//import fun.formoji.commons.model.ServiceCode;
//import org.springframework.http.HttpStatus;
//import org.springframework.security.access.AccessDeniedException;
//import org.springframework.security.web.access.AccessDeniedHandler;
//import org.springframework.stereotype.Component;
//
//import javax.servlet.ServletException;
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//import java.io.IOException;
//
///**
// * <code>CustomAccessDeniedHandler</code>
// * <desc>
// * 描述： 自定义没权限的时候返回的信息
// * <desc/>
// * <b>Creation Time:</b> 2020/12/15 17:04.
// *
// * @author hshe
// */
//@Component
//public class CustomAccessDeniedHandler implements AccessDeniedHandler {
//    @Override
//    public void handle(HttpServletRequest request, HttpServletResponse response, AccessDeniedException e) throws IOException, ServletException {
//        response.setStatus(HttpStatus.OK.value());
//        response.setHeader("Content-Type", "application/json;charset=UTF-8");
//        response.getWriter().write(JSON.toJSONString(RestResponse.build(ServiceCode.PERMISSION_NO_ACCESS)));
//    }
//}
